import { Body, Controller, Post } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { SubMonitorDto } from './dto/monitor.dto'
import { MonitorService } from './monitor.service'

@ApiTags('官网/二期/监控链接')
@Controller('web/monitor')
export class WebMonitorController {
  constructor(private readonly monitorService: MonitorService) {}

  /**
   * 监控回传
   */
  @Post()
  async onSubmit(@Body() body: SubMonitorDto) {
    switch (body.channel) {
      case 'QIHOO':
        return await this.monitorService.onSubmitForQihoo(body)
      case 'BAIDU':
        return await this.monitorService.onSubmitForBaidu(body)
    }
  }
}
